	var EpgConfig = function(opts){
		this.getPath=function(path){
			//return opts.contextPath + path +".ajax";
			return opts.contextPath + path;
		};
		this.showTip=function(text){
			$('#tip_text').html(text);
			$('#tip_text').show();
			setTimeout("$('#tip_text').hide()",3000);
		};
		this.defaultCallback = typeof(opts.success)!="undefined"?opts.success:function(data){
			if(data.message){
				showTip(data.message);
			}
		};
		this.fail= typeof(opts.fail)!="undefined"?opts.fail:function(){
			alert("error");
		};
		this.opError =function(){
			setTimeout(function(){
					$("#loadingToast").hide();
					showFail('&nbsp;&nbsp;对不起，<br/>请稍后再试',1000);
			},1000);
		};
		this.error= typeof(opts.error)!="undefined"?opts.error:function(XMLResponse){
			alert(XMLResponse.responseText)
		};
		this.getOnlineStb=function(){
		   var result = new Array();
		
			  for(var i=0;i<this.stbInfos.stbs.length;i++){
				  var stb = this.stbInfos.stbs[i];
				  if(stb.online){
					  result.push(stb.stbNo);
				  }  
			  }
		 
			  return result;
		  
		};
		this.isOnline =function(){
			if(this.isBind(true)){
				if( this.stbInfos.onlineCount==0){
				   return false;
				}else{
					return true;
				}
			}
			
			return false;
		}
		this.isPlaying =function(){
			if(this.isBind(true)){		
				if( this.stbInfos.playCount==0){
					return false;
				}else{
					return true;
				}
			}
			return false;
		}
		this.isBind =function(show){
			if(!this.stbInfos){
				this.info();
			}
			var result = this.stbInfos.stbs.length>0;
			if(show && !result){
				BootstrapDialog.alert('没有关联机顶盒');    
			}
			return result;
		}	
		this.info =function(callback){
			var path = this.getPath("/stb/info");
			$.ajax({
					type:"GET",
					url:path,
				    async:false,
				    context:this,
					dataType:"json",
					success:function(data){
						this.stbInfos = data;
						if(callback){
							callback(data);
						}
						
					},
					failure:this.fail	
				}
			);
		}
	}
	function showTip(text){
		$('#tip_text').html(text);
		$('#tip_text').show();
		setTimeout("$('#tip_text').hide()",3000);
	};
	var EpgContent = function(type,code,prog,title,icon) {
		this.code =code;
		this.type = type;
		this.title =title,
		this.icon = icon,
		this.prog = prog;
	}
	
	var EpgCollection = function(contentId,contentName,contentPoster,contentType,path,userId,category){
		this.contentId = contentId;
		this.contentName = contentName;
		this.contentPoster = contentPoster;
		this.contentType = contentType;
		this.path = path;
		this.userId = userId;
		this.category = category;
	}
	
	var UserComment = function(type,code) {
		this.code =code;
		this.type = type;
		this.comment = null;
		this.dig  = 0;
		this.star = 0;
	}
	
	var UserMedia = function(mediaId,title,tags) {
		this.mediaId = mediaId;
		this.title =title,
		this.tags = tags;
	}
	var PlayCtrlCmd = function(cmd,ctrl,value,content){
		this.ctrl =ctrl;
		this.cmd = cmd;
		if(typeof(value)!="undefined"){
			this.value = value;
		}
		if(typeof(content)!="undefined"){
			this.type=content.type;
			this.code=content.code;
			this.title=content.title;
			this.prog=content.prog;
			this.icon=content.icon;
		}
	}

	var PhotoCtrl =function(config){
		this.paths={rotateUrl:"/photo/rotate",editUrl:"/photo/edit",removeUrl:'/photo/remove',shareUrl:'/photo/share',deleteUrl:"/photo/dels"};
		this.rotate=function(mediaId,value,callback){
			if(typeof(callback)=="undefined"){
				callback = config.defaultCallback;
			}
			var path = config.getPath(this.paths.rotateUrl);
			$.ajax({
				type:"POST",
				url:path,
			    async:false,
			    data:{mediaId:mediaId,rotate:value},
				dataType:"json",
				success:callback,
				failure:config.fail,
				error:config.error
			 }
		   )
		};
		this.dels=function(url,code,callback){
			if(typeof(callback)=="undefined"){
				callback = config.defaultCallback;
			}
			//var path = config.getPath(this.paths.deleteUrl);
			$.ajax({
					type:"POST",
					url:url,
				    async:false,data:{mediaIds:code},
					dataType:"json",
					success:callback,
					failure:config.fail,
					error:config.error
				}
			)
		};
		this.edit=function(media,callback){
			if(typeof(callback)=="undefined"){
				callback = config.defaultCallback;
			}
			var path = config.getPath(this.paths.editUrl);
			$.ajax({
				type:"POST",
				url:path,
			    async:false,
			    data:media,
				dataType:"json",
				success:callback,
				failure:config.fail,
				error:config.error
			 }
		   )			
		};
		this.share =function(mediaId,shared,callback){
			if(typeof(callback)=="undefined"){
				callback = config.defaultCallback;
			}
			var path = config.getPath(this.paths.shareUrl);
			$.ajax({
				type:"POST",
				url:path,
			    async:false,
			    data:{mediaId:mediaId,share:shared},
				dataType:"json",
				success:callback,
				failure:config.fail
			 }
		   )			
		};
		this.remove=function(mediaId,callback){
			if(typeof(callback)=="undefined"){
				callback = config.defaultCallback;
			}
			var path = config.getPath(this.paths.removeUrl);
			$.ajax({
				type:"POST",
				url:path,
			    async:false,
			    data:{mediaId:mediaId},
				dataType:"json",
				success:callback,
				failure:config.fail
			 }
		   )				
		}
	}
	var FavCtrl = function(config){
		this.paths = {addUrl:"/user/fav/vod/add",listUrl:"/user/fav/vod/list",removeUrl:'/user/fav/vod/remove',deleteUrl:"/user/fav/vod/batchDel"};
		this.remove=function(userId,contentId,callback){
			if(typeof(callback)=="undefined"){
				callback = this.removeFavCallback;
			}
			var path = config.getPath(this.paths.removeUrl);
			$.ajax({
					type:"POST",
					url:path,
				    async:false,data:{userId:userId,contentId:contentId},
					dataType:"json",
					success:callback,
					failure:config.fail,
					//error:config.error
					error:config.opError
				}
			)
		};
		
		this.dels=function(code,callback){
			if(typeof(callback)=="undefined"){
				callback = this.removeFavCallback;
			}
			var path = config.getPath(this.paths.deleteUrl);
			$.ajax({
					type:"POST",
					url:path,
				    async:false,data:{codes:code},
					dataType:"json",
					success:callback,
					failure:config.fail,
					//error:config.error
					error:config.opError
				}
			)
		};
		
		this.addFavCallback=function(data){
			localStorage.setItem(data.code,data.type);
			 config.defaultCallback(data);
		}
		this.removeFavCallback=function(data){
			localStorage.removeItem(data.code);
			config.defaultCallback(data);
		}
		this.isFav=function(code,callback){
			var code = localStorage[code];
			if(code){
				callback(true);
			}else{
				callback(false);
			}
		}
		this.add=function(content,callback){
			if(typeof(callback)=="undefined"){
				callback = this.addFavCallback;
			}
			var path = config.getPath(this.paths.addUrl);
			$.ajax({
				type:"POST",
				url:path,
			    async:false,data:content,
				dataType:"json",
				success:callback,
				failure:config.fail,
				//error:config.error
				error:config.opError
				})		
		};
		this.list=function(type,callback){
			if(typeof(callback)=="undefined"){
				callback = config.defaultCallback;
			}
			var path = config.getPath(this.paths.listUrl);
			$.ajax({
				type:"POST",
				url:path,
			    async:false,data:{type:type},
				dataType:"json",
				success:callback,
				failure:config.fail,
				error:config.error}	)		
		}
	}
	var SubscriberCtrl = function(config){
		this.paths = {addUrl:"/user/subscr/add",listUrl:"/user/subscr/list",removeUrl:'/user/subscr/remove',deleteUrl:'/user/subscr/dels'};
		this.remove=function(content,callback){
			if(typeof(callback)=="undefined"){
				callback = config.defaultCallback;
			}
			var path = config.getPath(this.paths.removeUrl);
			$.ajax({
					type:"POST",
					url:path,
				    async:false,data:content,
					dataType:"json",
					success:callback,
					error:config.opError,
					failure:config.fail
				}
			)
		};
		this.dels=function(code,stbNo, userId, callback){
			if(typeof(callback)=="undefined"){
				callback = config.defaultCallback;
			}
			var path = config.getPath(this.paths.deleteUrl);
			$.ajax({
					type:"POST",
					url:path,
				    async:false,data:{codes:code,stbNo:stbNo,userId:userId},
					dataType:"json",
					success:callback,
					error:config.opError,
					failure:config.fail
				}
			)
		};
		this.add=function(content,callback){
			var path = config.getPath(this.paths.addUrl);
			if(typeof(callback)=="undefined"){
				callback = config.defaultCallback;
			}
			$.ajax({
				type:"POST",
				url:path,
			    async:false,data:content,
				dataType:"json",
				success:callback,
				error:config.opError,
				failure:config.fail
				}
			)		
		};
		this.list=function(type,callback){
			var path = config.getPath(this.paths.listUrl);
			if(typeof(callback)=="undefined"){
				callback = config.defaultCallback;
			}
			$.ajax({
				type:"POST",
				url:path,
			    async:false,data:{type:type},
				dataType:"json",
				success:callback,
				failure:config.fail
				}
			)		
		}
	};
	var BindCtrl =function(config){
		this.paths={indexUrl:"/bind/index",removeUrl:"/bind/remove",masterUrl:'/bind/master',swtichUrl:'/bind/switch',onlineUrl:'/bind/online'};
		this.index=function(){
			var path = config.getPath(this.paths.indexUrl);
			if(typeof(callback)=="undefined"){
				callback = config.defaultCallback;
			}
			$.ajax({
					type:"POST",
					url:path,
				    async:false,
					dataType:"json",
					success:callback,
					failure:config.fail
				}
			)			
		},
		this.remove=function(stbNo,callback){
			var path = config.getPath(this.paths.removeUrl);
			if(typeof(callback)=="undefined"){
				callback = config.defaultCallback;
			}
			$.ajax({
					type:"POST",
					url:path,
				    async:false,
				    data:{stbNo:stbNo},
					dataType:"json",
					success:callback,
					failure:config.fail
				}
			)			
		};
		this.master=function(stbNo){
			var path = config.getPath(this.paths.masterUrl);
			if(typeof(callback)=="undefined"){
				callback = config.defaultCallback;
			}
			$.ajax({
					type:"POST",
					url:path,
				    async:false,
				    data:{stbNo:stbNo},
					dataType:"json",
					success:callback,
					failure:config.fail
				}
			);		
		};
		this.switchStb=function(stbNo){
			var path = config.getPath(this.paths.swtichUrl);
			if(typeof(callback)=="undefined"){
				callback = config.defaultCallback;
			}
			$.ajax({
					type:"POST",
					url:path,
				    async:false,
				    data:{stbNo:stbNo},
					dataType:"json",
					success:callback,
					failure:config.fail
				}
			);	
		};
		this.online=function(callback){
			var path = config.getPath(this.paths.onlineUrl);
			if(typeof(callback)=="undefined"){
				callback = config.defaultCallback;
			}
			$.ajax({
					type:"POST",
					url:path,
				    async:false,
					dataType:"json",
					success:callback,
					failure:config.fail
				}
			);			
		}
	}
	var CommentCtrl = function(config){
		this.paths={addUrl:"/comment/add",list:"/comment/list"};
		this.add=function(content,callback){
			var path = config.getPath(this.paths.addUrl);
			if(typeof(callback)=="undefined"){
				callback = config.defaultCallback;
			}
			$.ajax({
					type:"POST",
					url:path,
				    async:false,
				    data:content,
					dataType:"json",
					success:callback,
					failure:config.fail
					
				}
			)
		};
		this.list=function(content,callback){
			var path = config.getPath(this.paths.list);
			if(typeof(callback)=="undefined"){
				callback = config.defaultCallback;
			}
			$.ajax({
					type:"GET",
					url:path,
				    async:false,
				    data:content,
					dataType:"html",
					success:callback,
					failure:config.fail
					
				}
			)
		};
	}
	var StbCtrl = function(config){
		this.paths={ctrlUrl:"/stb/playctrl",
				//playUrl:'/stb/play',
				playUrl:stbPlayUrl,
				jumpUrl:'/stb/jump',
				infoUrl:"/stb/info",
				deleteUrl:"/req/dels"};
		this.info =function(callback){
			var path = config.getPath(this.paths.infoUrl);
			$.ajax({
					type:"GET",
					url:path,
				    async:false,
				    data:content,
				    context:config,
					dataType:"json",
					success:function(data){
						this.stbInfos = data;
						if(callback){
							callback(data);
						}
						
					},
					failure:config.fail	
				}
			);
		}

		this.play=function(content,callback){
			var path = this.paths.playUrl;
			if(typeof(callback)=="undefined"){
				callback = function(){
					setTimeout("hideAlert('播放请求已发送')",2000);
				};
			}
			/*showLoading('正在请求播放',3000,function(){
				showToast('播放请求已经发送',1000);
			});*/
			showLoading('正在请求播放');
			$.ajax({
					type:"POST",
					url:path,
				    async:true,
				    data:content,
					dataType:"json",
					success:function(data){
						callback();
						addToHistory(content);
					},
					failure:config.fail
				}
			)
			
		};
		
		this.dels=function(codes,type, userId, delsUrl, callback){
			
			var path = config.getPath(this.paths.deleteUrl);
			if(typeof(callback)=="undefined"){
				callback = config.defaultCallback;
			}
			$.ajax({
					type:"POST",
					url:delsUrl,
				    async:false,
				    data:{codes:codes,type:type,userId:userId},
					dataType:"json",
					success:callback,
					failure:config.fail
				}
			)
		};
		
		this.jump=function(content,callback){
			var path = config.getPath(this.paths.jumpUrl);
			if(typeof(callback)=="undefined"){
				callback = config.defaultCallback;
			}
			$.ajax({
				type:"POST",
				url:path,
			    async:false,data:content,
				dataType:"json",
				success:callback,
				failure:config.fail
				}
			)		
		};
		this.ctrl=function(playCtrl,callback){
			var path = this.paths.ctrlUrl;
			if(typeof(callback)=="undefined"){
				callback = config.defaultCallback;
			}
			$.ajax({
				type:"POST",
				url:path,
			    async:false,data:playCtrl,
				dataType:"json",
				success:callback,
				failure:config.fail
				}
			)			
		};
		this.stop=function(callback){
			
			var cmd = new PlayCtrlCmd("playctrl","stop");
			this.ctrl(cmd,callback);
		};
		this.switchContent=function(content,callback){
			var cmd = new PlayCtrlCmd("playctrl","switch",0,content);
			this.ctrl(cmd,callback);	
		};
		this.pause=function(callback){
			var cmd = new PlayCtrlCmd("playctrl","pause");
			this.ctrl(cmd,callback);	
		};
		this.resume=function(callback){
			var cmd = new PlayCtrlCmd("playctrl","resume");
			this.ctrl(cmd,callback);
		};
		this.seek=function(value,callback){
			var cmd = new PlayCtrlCmd("playctrl","seek",value);
			this.ctrl(cmd,callback);		
		};
		this.volume=function(value,callback){
			var cmd = new PlayCtrlCmd("playctrl","volume",value);
			this.ctrl(cmd,callback);		
		}
	}
	function showTip(text){
		$('#tip_text').html(text);
		$('#tip_text').show();
		setTimeout("$('#tip_text').hide()",3000);
	};
	/*if(typeof(BootstrapDialog)){
		 BootstrapDialog.DEFAULT_TEXTS[BootstrapDialog.TYPE_DEFAULT] = '提示';
   		 BootstrapDialog.DEFAULT_TEXTS[BootstrapDialog.TYPE_INFO] = '提示';
    	 BootstrapDialog.DEFAULT_TEXTS[BootstrapDialog.TYPE_PRIMARY] = '提示';
   		 BootstrapDialog.DEFAULT_TEXTS[BootstrapDialog.TYPE_SUCCESS] = '提示';
   		 BootstrapDialog.DEFAULT_TEXTS[BootstrapDialog.TYPE_WARNING] = '警告';
   		 BootstrapDialog.DEFAULT_TEXTS[BootstrapDialog.TYPE_DANGER] = '警告';
  		 BootstrapDialog.DEFAULT_TEXTS['OK'] = '确定';
  		 BootstrapDialog.DEFAULT_TEXTS['CANCEL'] = '取消';
   		 BootstrapDialog.DEFAULT_TEXTS['CONFIRM'] = '确认';		
		
	};*/
	function loading(opts){
		var $div = $(opts.element);
		var $img = $(opts.element+"_image img");
		var width = window.innerWidth;
		var height = window.innerHeight;
		
	
		$div.css("width",width+"px");
		$div.css("height",height+"px");
		$div.css("top","0px");
		$div.css("left","0px");
		var imgW= (width-$img.width())/2;
		var imgH=(height-$img.height())/2;
		$img.parent().css("left",imgW+"px");
		$img.parent().css("top",imgH+"px");
		$(opts.element).show();
		if(opts.timeout>0){
			setTimeout(function(){
				$(opts.element).hide();
				opts.callback();
			},opts.timeout);
		}
	};
	
	var RemoteCtrlDialog = function(mPath, fPath) {
		this.change_flag = 0;
		this.changeImg = "change.png";
		this.numImg = "change_num.png";
		this.min_path = mPath;
		this.full_path = fPath;
		this.ctrlTitle = "按钮遥控";
		this.numTitle = "数字遥控";
		this.open = function() {
			this.getAjaxData(this.min_path);
		};
		this.close = function() {
			$("#remoteCtrl").html("");
			$("#remoteCtrl").hide();
		};
		this.full = function() {
			this.close();
			this.getAjaxData(this.full_path);
		};
		this.small = function() {
			this.close();
			this.getAjaxData(this.min_path);
		};
		this.getAjaxData = function(aPath) {
			$.ajax({
				type:"POST",
				url:aPath,
			    async:false,
			    data:"",
				dataType:"html",
				success:remoteCtrlDialog.callBack,
				failure:function() {
				}
			})
		};
		this.callBack = function(content) {
			$("#remoteCtrl").html(content);
			$("#remoteCtrl").show();
		};
		this.change = function() {
			if(this.change_flag == 0) {
				this.change_flag = 1;
				$("#ctrl_layer").hide();
				$("#num_layer").show();
				this.onclick("rc_change", fImgPath + "/" + this.numImg);
				$("#remoteCtrlName").html(this.numTitle);
			} else {
				this.change_flag = 0;
				this.onclick("rc_change", fImgPath + "/" + this.changeImg);
				$("#ctrl_layer").show();
				$("#num_layer").hide();
				$("#remoteCtrlName").html(this.ctrlTitle);
			}
		};
		this.onclick = function(id, image) {
			$("#" + id).attr("src", image);
		};
	}
	
	var imageObj = {
		id : "",
		cImg : function(newId, imgPath, func) {
			$("#" + newId).attr("src", imgPath + "/" + (newId + "-s.png"));
			setTimeout("imageObj.restore('" + newId +"','" +
				(imgPath + "/" + (newId + ".png")) + "')", 500);
			if(arguments.length > 2) {
				eval(func);
			}
		},
		cPanelImg : function(panelId, newId, imgPath, func) {
			$("#" + panelId).attr("src", imgPath + "/" + (newId + "-s.png"));
			setTimeout("imageObj.restore('" + panelId +"','" +
				(imgPath + "/" + (panelId + ".png")) + "')", 500);
			if(arguments.length > 3) {
				eval(func);
			}
		},
		restore : function(_id, _attr) {
			$("#" + _id).attr("src", _attr);
		}
	};
	
	function remoteShow() {
		var stbNo = weixinOption.getStbNo();
		if(stbNo==""){
			gotoLink(personUrl);
		}else{
			isOnline(stbNo,function(data){
				remoteCtrlDialog.open();
			},function(data){
				$("#boxNotOnLine").show();
				setTimeout(function(){
					$("#boxNotOnLine").hide();
				},800);
			});
		}
	}
	
	function isBindStb() {
		if(typeof binds != "undefined" && binds != null) {
			if(binds.length > 0) {
				return true;
			}
		}
		return false;
	}
	
	function remoteCtrlCheck() {
		$("#rc_flag_img").show();
	}
	
	var WeixinStorage = function(name) { 
	    this.id = 0;
	    this.storageName = name;
	    this.records = new Array();
	    this.init = function(){
	    	var record = localStorage.getItem(this.storageName);
	    	if(record){
	    		this.records = JSON.parse(record);
	    	}else{
	    		localStorage.setItem(this.storageName,"[]");
	    	}
	    }
	    this.add= function(content){
	    	var idx = this.index(content.contentId);
	    	if(idx > -1){
	    		this.records.splice(idx, 1);
	    	}
	    	this.records.splice(0,0,content);
	    	this.save();
	    }
	    this.save = function(){
	    	var record = JSON.stringify(this.records);
		    localStorage.setItem(this.storageName,record);
		    //console.log(record);
	    }
	    this.remove = function(code){
	    	var idx = this.index(code); 
	    	if(idx > -1){
	    		this.records.splice(idx, 1);
	    		this.save();
	    	}
	    	return idx;
	    }
	   this.exist = function(code){
	    	return this.index(code)>-1;
	    }
	    this.index = function(code){
	    	for(var i = 0;i<this.records.length;i++){
    			if(this.records[i].contentId == code){
    				return i;
    			}
	    	}
	    	return -1;
	    }
	    this.clear = function(){
	    	this.records = [];
	    }
	};
	function showToast(title,timeout){
		$("#toast_title").html(title);
		$("#toast").show();
		if(timeout){
			setTimeout(function(){$("#toast").hide();},timeout);
		}
	}
	function showFail(title,timeout){
		$("#fail_title").html(title);
		$("#fail").show();
		if(timeout){
			setTimeout(function(){$("#fail").hide();},timeout);
		}
	}
	function showLoading(title,timeout,callback){
		$("#loading_title").html(title);
		$("#loadingToast").show();
		if(timeout){
			setTimeout(function(){
				$("#loadingToast").hide();
				if(callback){
						callback();
				}				
				},timeout);
		}
	}
	
	function showAlert(title,timeout){
		$("#alertDiv").html(title);
		$("#alertDiv").show();
		if(timeout){
			setTimeout(function(){$("#alertDiv").hide();},timeout);
		}
	}
	var playStorage = new WeixinStorage("storage_play");
	playStorage.init();
	var favStorage = new WeixinStorage("storage_fav");
	favStorage.init();
	var yuyueStorage = new WeixinStorage("storage_yuyue");
	yuyueStorage.init();
	var searchStorage = new WeixinStorage("storage_search");
	searchStorage.init();
	
	function strExist(str) {
		if (str != null && str != "" && (typeof str) != "undefined"&&str!="undefined") {
			return true;
		}
		return false;
	}
	//给指定URL增加链接参数
	function addUrlParameter(url, paraName, paraValue) {
	    if (paraName == '') return url;
	    var updateUrl;
	    if (url.indexOf(paraName) == -1) {
	        if (url.indexOf("?") == -1)
	            updateUrl = url + '?' + paraName + '=' + paraValue;
	        else
	            updateUrl = url + '&' + paraName + '=' + paraValue;
	    }else{
	    	var reg = new RegExp(paraName + "=\\w*","g");
	    	updateUrl = url.replace(reg,paraName + "=" +paraValue);
	    }
	    return updateUrl;
	}
	
	function gotoLinkWithPageInfo(url,leaveId,pageIndex,idIndex){
	    gotoLink(addPageInfo(url,pageIndex,idIndex),leaveId);
	}
	function addPageInfo(url,pageIndex,idIndex){
		if(strExist(pageIndex)){
			url = addUrlParameter(url,"pageIndex",pageIndex);
	    }
	    if(strExist(idIndex)){
	    	url = addUrlParameter(url,"idIndex",idIndex);
	    }
	    return url;
	}
	
	function hideAlert(text,id,src){
		$('#loadingToast').hide();
		showToast(text,2000);
		if(arguments.length > 2){
			$("#"+id).attr("src",src);
		}
	}
	function removePX(value){
		return parseInt(value.substring(0,value.indexOf("px")));
	}
	
	function play(params,personUrl,id,callback){
		var stbNo = weixinOption.getStbNo();
		if(stbNo != ""){
			isOnline(stbNo,function(data){
				params.stbNo = stbNo;
				stbCtrl.play(params,callback);
			},function(data){
				$("#boxNotOnLine").show();
				setTimeout(function(){
					$("#boxNotOnLine").hide();
				},800);
			});
		}else{
			gotoLink(personUrl,id);
		}
	}
	$(function(){  
	    // 设置jQuery Ajax全局的参数  
	    $.ajaxSetup({  
	        type: "POST",  
	        error: function(jqXHR, textStatus, errorThrown){  
	        	setTimeout(function(){
	        		if($("#loadingToast")){
	        			$("#loadingToast").hide();
	        		}
					showFail('参数错误',2000);
	        	},2000);
	        }
	    });  
	}); 
	$(function(){  
	    // 设置jQuery Ajax全局的参数  
	    $.ajaxSetup({  
	        type: "GET",  
	        error: function(jqXHR, textStatus, errorThrown){  
	        	setTimeout(function(){
	        		if($("#loadingToast")){
	        			$("#loadingToast").hide();
	        		}
					showFail('参数错误',2000);
	        	},2000);
	        }
	    });  
	});
	
	function getDate(datelong, symbol) {
		if(datelong.length == 8) {
			var year = datelong.substring(0, 4);
			var month = datelong.substring(4, 6);
			var day = datelong.substring(6);
			var result = month + day;
			if(arguments.length > 1) {
				result = month + symbol + day;
			}
			console.log(result);
			return result;
		}
		return "";
	}